﻿@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_LayoutChild.cshtml";
}
@model Agro.Models.T_Organization
@section head
{
    <script language="javascript" type="text/javascript">
        var _type = '@ViewBag.type';
        $(document).ready(function () {
            if (_type != null && _type == "edit")
                $("#Organization_Code").attr("disabled", "disabled");
            $("input[name='Organization_Type']").click(function () {
                if ($(this).val() == "1") {
                    $("#NYSX").show();   
                }
                else
                    $("#NYSX").hide();
            });
            $("input[name='Organization_Type']").each(function (i) {
                if (this.checked) {
                    if (this.value == "0") {
                        $("#NYSX").hide();
                    }
                    else
                        $("#NYSX").show();
                }
            });
        });
        function Save(t) {
            //前端验证
            var code = $("#Organization_Code").val();
            if (code == "") {
                alert("部门编号不能为空!");
                return;
            }
            var name = $("#Organization_Name").val();
            if (name == "") {
                alert("部门名称不能为空!");
                return;
            }

            $.funSaveForm("/SystemManage/Organization/Save", "formDetail", function (d) {
                var type = $("#Organization_ID").val() == "" ? "add" : "edit"; //判断是新增还是编辑
                if (d == undefined || d == "") {
                    parent.asyncbox.tips('保存失败!', 'error');
                    return;
                }
                else {
                    $("#Organization_ID").val(d);
                    parent.asyncbox.tips('保存成功!', 'success');
                    MainFrame().refreshTreeNode(type);
                    parent.$.close(t.id);
                }
            });

        }

    </script>
}
<!--主窗体，页面都需要的div-->
<div class="ui-layout-center" style="overflow: hidden;">
    @using (Html.BeginForm("", "", FormMethod.Post, new Dictionary<string, object> { { "id", "formDetail" } }))
    {
          
        @Html.HiddenFor(model => model.Organization_ParentID)
        @Html.HiddenFor(model => model.Organization_ID)
        <div class='b-col'>
            <div class="col-name">
                <font color="blue">单位编号：</font></div>
            <div class="col-input">@Html.TextBoxFor(model => model.Organization_Code)</div>
        </div>
        <div class='b-col'>
            <div class="col-name">
                <font color="blue">单位名称：</font></div>
            <div class="col-input">@Html.TextBoxFor(model => model.Organization_Name)</div>
        </div>
        <div class='b-col'>
            <div class="col-name">
                单位描述：</div>
            <div class="col-input">@Html.TextBoxFor(model => model.Organization_Remark)</div>
        </div>
        <div class='b-col'>
            <div class="col-name">
                单位电话：</div>
            <div class="col-input">@Html.TextBoxFor(model => model.Organization_Phone)</div>
        </div>
        <div class='b-col'>
            <div class="col-name">
                单位邮箱：</div>
            <div class="col-input">@Html.TextBoxFor(model => model.Organization_Email)</div>
        </div>
        <div class='b-col'>
            <div class="col-name">
                单位地址：</div>
            <div class="col-input">@Html.TextBoxFor(model => model.Organization_Address)</div>
        </div>
        <div class='b-col'>
            <div class="col-name">
                单位联系人：</div>
            <div class="col-input">@Html.TextBoxFor(model => model.Organization_Contact)</div>
        </div>
        <div class='b-col'>
            <div class="col-name">
                上级单位：</div>
            <div class="col-input">@Html.TextBox("Organization_ParentName", (string)ViewBag.Organization_ParentName, new { @readonly = "readonly" })</div>
        </div>
        <div class='b-col'>
            <div class="col-name">
                单位排序：</div>
            <div class="col-input">@Html.TextBoxFor(model => model.Organization_Order)</div>
        </div>
        <div class='b-col' style="width: 500px;">
            <div class="col-name">
                单位类型：</div>
            <div class="col-input" style="width: 300px;">
                @Html.RadioButtonFor(model => model.Organization_Type, "0")<label>管理部门</label>
                &nbsp;&nbsp;@Html.RadioButtonFor(model => model.Organization_Type, "1")<label for="Organization_Type">企业部门</label></div>
        </div>
        <div style="clear: both; display: none" id="NYSX">
            <div class='b-col' style="width: 500px;">
                <div class="col-name">
                    龙头企业级别：</div>
                <div class="col-input" style="width: 375px;">@Html.RadioButtonFor(model => model.Organization_Level, "0")<label>无</label>&nbsp;&nbsp;@Html.RadioButtonFor(model => model.Organization_Level, "1")<label>国家级</label>&nbsp;&nbsp;@Html.RadioButtonFor(model => model.Organization_Level, "2")<label>省级</label>&nbsp;&nbsp;@Html.RadioButtonFor(model => model.Organization_Level, "3")<label>市级</label>&nbsp;<font
                    color='red'>注：不是龙头企业请选择无</font></div>
            </div>
            <div class='b-col'>
                <div class="col-name">
                    是否休闲农业：</div>
                <div class="col-input">
                    @Html.RadioButtonFor(model => model.Organization_Leisure, "1")<label>是</label>&nbsp;&nbsp;@Html.RadioButtonFor(model => model.Organization_Leisure, "0")<label
                        for="">否</label></div>
            </div>
        </div>
       
    }
</div>
